#!/bin/bash -e

if [ $# -lt 1 ]; then
  echo "$0 <src rpm>"
  exit 1
fi

f=$1

pkg=$(basename $f)
echo "processs package $pkg ..."
name=$(rpm -qp --queryformat "%{NAME}" ${f})
osc mkpac ${name}
pushd ${name}
rpm2cpio ${f} | cpio -id
osc add *
osc ci -m "add package ${pkg}"
popd
